<?php

ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';

use Biz\model\PhotoRelaGoods as BizPhotoRelaGoods;
use Doraemon\model\Photos as DmPhotos;


$id = 0;

$photoRelaGoods = BizPhotoRelaGoods::get('*', [
	'id[>]' => $id,
	'ORDER' => ['id' => 'ASC']
]);

while ($photoRelaGoods) {

	$photoInfo = DmPhotos::get('*', ['id' => $photoRelaGoods['photo_id']]);
	BizPhotoRelaGoods::update([
		'note_id' => $photoRelaGoods['photo_id'],
		'pic_id' => $photoInfo['pic_id']
	], [
		'id' => $photoRelaGoods['id']
	]);

	$id = $photoRelaGoods['id'];

	echo $id . "\r\n";

	$photoRelaGoods = BizPhotoRelaGoods::get('*', [
		'id[>]' => $id,
		'ORDER' => ['id' => 'ASC']
	]);
}

